load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//prow:def.bzl", "prow_image")

go_library(
    name = "go_default_library",
    srcs = ["main.go"],
    importpath = "k8s.io/test-infra/prow/cmd/clonerefs",
    visibility = ["//visibility:private"],
    deps = [
        "//prow/clonerefs:go_default_library",
        "//prow/logrusutil:go_default_library",
        "//prow/pod-utils/options:go_default_library",
        "@com_github_sirupsen_logrus//:go_default_library",
    ],
)

NAME = "clonerefs"

go_binary(
    name = NAME,
    embed = [":go_default_library"],
    pure = "on",
    visibility = ["//visibility:public"],
)

prow_image(
    name = "image",
    base = "@git-base//image",
    component = NAME,
    files = [
        "github_known_hosts",
        "ssh_config",
    ],
    symlinks = {
        "/clonerefs": "/app/prow/cmd/clonerefs/app.binary",
        "/etc/ssh/ssh_config": "/ssh_config",
    },
    visibility = ["//visibility:public"],
)

filegroup(
    name = "package-srcs",
    srcs = glob(["**"]),
    tags = ["automanaged"],
    visibility = ["//visibility:private"],
)

filegroup(
    name = "all-srcs",
    srcs = [":package-srcs"],
    tags = ["automanaged"],
    visibility = ["//visibility:public"],
)
